package com.sanyue.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author: Guan
 **/
@Controller
public class IndexController {
    //编写方法，返回admin页面
    // public static final String DEFAULT_PREFIX = "classpath:/templates/";
    // public static final String DEFAULT_SUFFIX = ".html";

    /**
     *  解读：
     *    1.我们引入了thymeleaf
     *    2.public static final String DEFAULT_PREFIX = "classpath:/templates/";
     *      public static final String DEFAULT_SUFFIX = ".html";
     *      thymeleaf已经自动配置了视图解析器
     *    3.这里直接使用视图解析器解析到thymeleaf下的模板文件classpath:/templates/admin.html
     *
     *    补充：value = {"/","/login"}数组模式，
     *         "/"访问地址：localhost:8080/
     */
    @GetMapping(value = {"/","/login"})
    public String login(){
        return "admin";
    }
}
